package com.project.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.project.bean.FacilitiesBean;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface IFacilitiesMapper extends BaseMapper<FacilitiesBean> {

    @Select("SELECT f.* FROM t_facilities f JOIN t_room r ON f.`fk_roomId`=r.`pk_roomId` WHERE r.`pk_roomId`=#{id}")
    @ResultMap("facilitiesMap")
    List<FacilitiesBean> findByRoomId(Integer roomId);


    void add (FacilitiesBean facilities);


    void update(@Param("id") Integer facilityId);
}
